using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Lifter.Utility
{
	public class Win32API
	{
		public const int WM_NCLBUTTONDOWN = 161;
		public const int HT_CAPTION = 2;
		[DllImport("user32.dll")]
		public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
		[DllImport("user32.dll")]
		public static extern bool ReleaseCapture();
		[DllImport("kernel32.dll")]
		private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
		[DllImport("kernel32.dll")]
		private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
		public static long IniWriteValue(string Section, string Key, string Value, string avsPath)
		{
			return Win32API.WritePrivateProfileString(Section, Key, Value, avsPath);
		}
		public static string IniReadValue(string Section, string Key, string avsPath)
		{
			int bufferSize = 2000;
			StringBuilder stringBuilder = new StringBuilder(bufferSize);
			int privateProfileString = Win32API.GetPrivateProfileString(Section, Key, "", stringBuilder, bufferSize, avsPath);
			string result;
			if (stringBuilder == null)
			{
				result = null;
			}
			else
			{
				result = stringBuilder.ToString();
			}
			return result;
		}
	}
}
